home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / advc11.zip / EQUIPMNT.C < prev    next >
Text File  |  1987-04-23  |  2KB  |  100 lines

  1. int commports()                       /* get number of serial ports */
  2. {
  3.    union REGS inregs;
  4.    union REGS outregs;
  5.    int86(0x11,&inregs,&outregs);
  6.    return((outregs.h.ah & 15) >> 1);
  7. }
  8.  
  9.  
  10.  
  11. int displaytype()                     /* get display type */
  12. {
  13.    union REGS inregs;
  14.    union REGS outregs;
  15.  
  16.    inregs.h.ah = 15;
  17.    int86(0x10,&inregs,&outregs);
  18.    return((outregs.h.al != 7));
  19. }
  20.  
  21.  
  22.  
  23. long drivespace(drv)                  /* get free space on a given drive */
  24.    char drv;
  25. {
  26.    union REGS inregs;
  27.    union REGS outregs;
  28.  
  29.    inregs.h.ah = 0x36;
  30.    if (drv == '@') inregs.h.dl = 0;
  31.    else inregs.h.dl = toupper(drv) - 'A' + 1;
  32.    intdos(&inregs,&outregs);
  33.    return((long) outregs.x.ax * outregs.x.bx * outregs.x.cx);
  34. }
  35.  
  36.  
  37.  
  38. char getdrive()                       /* get default drive */
  39. {
  40.    return((bdos(0x19,0,0) & 255)+'A');
  41. }
  42.  
  43.  
  44.  
  45. int joystick()                        /* see if there's a joystick */
  46. {
  47.    union REGS inregs;
  48.    union REGS outregs;
  49.    int86(0x11,&inregs,&outregs);
  50.    return((outregs.h.ah >> 4) & 1);
  51. }
  52.  
  53.  
  54.  
  55. int limmfree()                        /* get free pages of expanded memory */
  56. {
  57.    int freemem = 0;
  58.    union REGS inregs;
  59.    union REGS outregs;
  60.  
  61.    inregs.h.ah = 0x42;
  62.    int86(0x67,&inregs,&outregs);
  63.    if (!outregs.h.ah) freemem = outregs.x.bx;
  64.    return(freemem);
  65. }
  66.  
  67.  
  68.  
  69. int limmtotal()                       /* get total pages of expanded memory */
  70. {
  71.    int totalmem = 0;
  72.    union REGS inregs;
  73.    union REGS outregs;
  74.  
  75.    inregs.h.ah = 0x42;
  76.    int86(0x67,&inregs,&outregs);
  77.    if (!outregs.h.ah) totalmem = outregs.x.dx;
  78.    return(totalmem);
  79. }
  80.  
  81.  
  82.  
  83. int printports()                      /* get number of parallel ports */
  84. {
  85.    union REGS inregs;
  86.    union REGS outregs;
  87.    int86(0x11,&inregs,&outregs);
  88.    return(outregs.h.ah >> 6);
  89. }
  90.  
  91.  
  92.  
  93. int totalmem()                        /* get Kbytes of installed RAM */
  94. {
  95.    union REGS inregs;
  96.    union REGS outregs;
  97.    int86(0x12,&inregs,&outregs);
  98.    return(outregs.x.ax);
  99. }
  100.